﻿<UserControl xmlns:extToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended"  x:Class="WPFSolution.UserControls.MatrixCalculator"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" xmlns:Converters="clr-namespace:WPFSolution.Converters" Height="Auto"
             xmlns:local="clr-namespace:WPFSolution.UserControls">
    <UserControl.Resources>
        <Converters:DoubleToIntegerConverter x:Key="DoubleToIntegerConverter1" />
    </UserControl.Resources>
    <DockPanel LastChildFill="True">
        <ScrollViewer VerticalScrollBarVisibility="Auto">
            <StackPanel DockPanel.Dock="Left" MinWidth="250" MaxWidth="400" >
                <GroupBox Header="Number of dimentions to use">
                    <StackPanel>
                        <Slider x:Name="DimsAmountSlider" Minimum="3" Maximum="30" SmallChange="1" Value="3" BorderThickness="1" SelectionStart="50" AutoToolTipPlacement="TopLeft" IsMoveToPointEnabled="True" Interval="1" Orientation="Horizontal" IsSnapToTickEnabled="True" IsSelectionRangeEnabled="False" TickPlacement="BottomRight" PreviewMouseUp="DimsAmountSlider_PreviewMouseUp"></Slider>
                        <StackPanel Orientation="Horizontal">
                            <Label Content="Number" VerticalAlignment="Center"></Label>
                            <TextBox x:Name="DimentionsNumberTextBox" Width="100" Height="Auto" Text="{Binding ElementName=DimsAmountSlider, Path=Value, Converter={StaticResource DoubleToIntegerConverter1}}" IsReadOnly="True" IsEnabled="True" FontSize="28" BorderBrush="{x:Null}" Background="{x:Null}" DataContext="{Binding ElementName=DimsAmountSlider, Path=Value}" Focusable="False"></TextBox>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal">
                            <Label>
                                <Label.Content>
                                    Save filled values
                                </Label.Content>
                                <Label.ToolTip>Hi</Label.ToolTip>
                            </Label>
                            <CheckBox Name="SaveElementsCheckBox" VerticalAlignment="Center" IsChecked="True"></CheckBox>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="Fill Methods">
                    <StackPanel Orientation="Vertical">
                        <StackPanel Orientation="Vertical">
                            <ComboBox Name="FillMethodComboBox" Text="Choose Fill Method" IsSynchronizedWithCurrentItem="True" DisplayMemberPath="" SelectedIndex="0">
                                <ListBoxItem Name="IdentityFiller">Fill With Identity Matrix</ListBoxItem>
                                <ListBoxItem Name="SimpleFiller">Fill With Simple Random Matrix</ListBoxItem>
                                <ListBoxItem Name="ZeroEnterFiller">Fill With Zero Enter Matrix</ListBoxItem>
                                <ListBoxItem Name="DiagonalZeroEnterFiller">Fill With Zeros On Diagonal Matrix</ListBoxItem>
                                <ListBoxItem Name="DiagonalFiller">Fill With Diagonal Matrix</ListBoxItem>
                                <ListBoxItem Name="LinearFreeFiller">Fill With Linear Free Matrix</ListBoxItem>
                                <ListBoxItem Name="PositiveDefinedFiller">Fill With Positive Defined Matrix</ListBoxItem>
                                <ListBoxItem Name="DiagonalDominateFiller">Fill With Dominating Elements On Diagonal</ListBoxItem>
                                <ListBoxItem Name="DiagonalDominanceFiller">Fill With Diagonal Dominance Matrix</ListBoxItem>
                                <ListBoxItem Name="ImplicitDiagonalDominanceFiller">Fill With Matrix With Implicit Diagonal Dominance</ListBoxItem>
                                <ListBoxItem Name="PositiveDiagonalFiller">Fill With Positive Diagonal Matrix</ListBoxItem>
                                <ListBoxItem Name="FileContentFiller">Fill From File</ListBoxItem>
                            </ComboBox>
                            <DockPanel >
                                <DockPanel.ToolTip>
                                    Maximum 10000.0
                                Minimum 0.1
                                </DockPanel.ToolTip>
                                <Label DockPanel.Dock="Left">Average Matrix Element Value:</Label>
                                <extToolkit:WatermarkTextBox Height="Auto" Watermark="10,0" Name="AverageMatrixElementValueTextBox" MaxWidth="150" Width="Auto" LostFocus="AverageMatrixElementValueTextBox_LostFocus" />
                            </DockPanel>
                            <Button Name="MatrixFillButton" MaxWidth="100" Click="MatrixFillButton_Click">Fill System</Button>
                        </StackPanel>
                    </StackPanel>
                </GroupBox>
                <GroupBox Header="Solve Options">
                    <StackPanel Orientation="Vertical">
                        <local:AsyncTraceableIterationMethodComboBox x:Name="MethodsComboBox"></local:AsyncTraceableIterationMethodComboBox>
                        <DockPanel>
                            <DockPanel.ToolTip>
                                Maximum  100000
                            Minimum  1000
                            </DockPanel.ToolTip>
                            <Label Width="130">
                                Maximum Iterations
                            </Label>
                            <extToolkit:WatermarkTextBox Height="Auto" Watermark="1000" Name="MaximumIterationsTextBox" MaxWidth="150" Width="Auto" LostFocus="MaximumIterationsTextBox_LostFocus" />
                        </DockPanel>
                        <DockPanel>
                            <DockPanel.ToolTip>
                                Maximum 0,01
                            Minimum 0,000001
                            </DockPanel.ToolTip>
                            <Label Width="130">
                                Accuracy
                            </Label>
                            <extToolkit:WatermarkTextBox Height="Auto" Watermark="0,001" Name="AccuracyTextBox" MaxWidth="150" Width="Auto" LostFocus="AccuracyTextBox_LostFocus" />
                        </DockPanel>
                        <DockPanel>
                            <Label Width="130">Start Vector Is Zero</Label>
                            <CheckBox Name="StartVectorIsZeroCheckBox" VerticalAlignment="Center"></CheckBox>
                        </DockPanel>
                        <Button Name="SolveButton" MaxWidth="100" Click="SolveButton_Click">Solve System</Button>
                    </StackPanel>
                </GroupBox>
                <local:AnswerDetails x:Name="AnswerGroupBox"></local:AnswerDetails>
            </StackPanel>
        </ScrollViewer>
        <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto">
            <DockPanel DockPanel.Dock="Right" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <Label DockPanel.Dock="Top" Height="50" Content="System template" Padding="3"  FontSize="24" HorizontalAlignment="Center"></Label>
                <StackPanel DockPanel.Dock="Left"  Orientation="Vertical">
                    <Label DockPanel.Dock="Top" Height="30" Content="Matrix" Padding="3" FontSize="16" HorizontalAlignment="Center"></Label>
                    <Border BorderThickness="0,0,2,0" BorderBrush="#FF03A8C7">
                        <StackPanel Name="MatrixTemplatePanel" MinWidth="0" MinHeight="0"></StackPanel>
                    </Border>
                </StackPanel>
                <StackPanel DockPanel.Dock="Right"  Orientation="Vertical" HorizontalAlignment="Left">
                    <Label DockPanel.Dock="Top" Height="30" Content="Vector" Padding="3" FontSize="16" HorizontalAlignment="Center"></Label>
                    <StackPanel Name="VectorTemplatePanel" Orientation="Vertical" MinWidth="0" MinHeight="0"></StackPanel>
                </StackPanel>
            </DockPanel>
        </ScrollViewer>
    </DockPanel>
</UserControl>
